 <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";

	List allLifeInfo = (List) request.getAttribute("allLifeInfo");
	String pageStr = (String) request.getAttribute("pageStr");
	int allCounts = (Integer) request.getAttribute("allCounts");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">
		<title>生活信息管理</title>
		<link REL="stylesheet" TYPE="text/css" HREF="style.css">
<script>
	function getLifeInfoList(pageNum) {
		window.location.href = "doLifeInfo.do?opers3=getLifeInfoList&flag=" + document.forms[0].flag.value + "&typeId=" + document.forms[0].typeId.value + "&pageNum=" + pageNum;
	}
		function SetAllCheck(formObj, checkName) {
		var obj = eval("formObj." + checkName + ";");
		if (obj != null)
			for ( var i = 0; i < obj.length; i++) {
				obj[i].checked = formObj.allOper.checked;
			}
	}
	
	function GoPage() {
		document.forms[0].action = "doLifeInfo.do?opers3=getLifeInfoList&flag=" + document.forms[0].flag.value + "&typeId=" + document.forms[0].typeId.value;
		document.forms[0].submit();
	}
	
	function DoOperateDelete() {
		document.forms[0].action = "doLifeInfo.do?opers3=deleteLifeInfo";
		if (confirm("确定要执行该操作吗？删除之后不可恢复！")) {
			document.forms[0].submit();
		} else {
			return;
		}
	}
	
	function DoOperateShenHe() {
		document.forms[0].action = "doLifeInfo.do?opers3=shenHeLifeInfo";
		if (confirm("确定要执行该操作吗？")) {
			document.forms[0].submit();
		} else {
			return;
		}
	}	
</script>
	</head>

	<body text="#000000" leftmargin="0" topmargin="7" bgcolor="#FFFFFF">
		<table width="770" border="0" cellspacing="0" cellpadding="0"
			align="center">
			<tr>
				<td background="img/list-bg.jpg" valign="top">
					<br>
					<br>
					<form method="post" action="">
						<table width="80%" border="0" cellspacing="0" cellpadding="0"
							align="center">
							<tr>
								<td>
									<table width="100%" border="0" cellpadding="0" cellspacing="0">
										<tr>
											<td width="60%">
												<input type="hidden" name="showCount" value="20">
												<input type="hidden" name="pageNum" value="1">

												请选择生活信息类型：
												<select name="typeId" id="typeId">
													<option value="0" <%=request.getAttribute("typeId").equals("0") ? "selected" : ""%>> 
														所有类型
													</option>
													<option value="1" <%=request.getAttribute("typeId").equals("1") ? "selected" : ""%>>
														交友/征婚
													</option>
													<option value="2" <%=request.getAttribute("typeId").equals("2") ? "selected" : ""%>>
														招聘/求职
													</option>
													<option value="3" <%=request.getAttribute("typeId").equals("3") ? "selected" : ""%>>
														寻人/寻友
													</option>
													<option value="4" <%=request.getAttribute("typeId").equals("4") ? "selected" : ""%>>
														租车/拼车
													</option>
													<option value="5" <%=request.getAttribute("typeId").equals("5") ? "selected" : ""%>>
														房屋信息
													</option>
													<option value="6" <%=request.getAttribute("typeId").equals("6") ? "selected" : ""%>>
														招聘会
													</option>
													<option value="7" <%=request.getAttribute("typeId").equals("7") ? "selected" : ""%>>
														生活琐事
													</option>
													<option value="8" <%=request.getAttribute("typeId").equals("8") ? "selected" : ""%>>
														同乡会
													</option>
													<option value="9" <%=request.getAttribute("typeId").equals("9") ? "selected" : ""%>>
														新闻
													</option>
												</select>
												&emsp;&emsp;
												审核状态:
												<select id="flag" name="flag">													
													<option value="0" <%=request.getAttribute("flag").equals("0") ? "selected" : ""%>>未审核</option>
													<option value="1" <%=request.getAttribute("flag").equals("1") ? "selected" : ""%>>已审核</option>
												</select>
												&emsp;&emsp;
												<input type="button" name="Submit" value=" 查 询 " onClick="GoPage()">
											</td>
											<td align="right" valign="bottom">
												[
												<a href="admin/adminIndex.jsp"
													style="font-size: 12pt; color: #000099">返回控制台</a>]
											</td>
										</tr>
									</table>
								</td>
							</tr>

							<tr>
								<td>
									<table width="1000px" border="1" cellspacing="0" cellpadding="1">
										<tr align="center">
											<td bgcolor="#EFF8E0" height="25" class=text width="50">
												选中
											</td>
											<td bgcolor="#EFF8E0" height="25" class=text width="100">
												提交时间
											</td>
											<td width="40" height="25" bgcolor="#EFF8E0" width="100">
												所属类型
											</td>
											<td bgcolor="#EFF8E0" height="25" class=text width="100">
												信息种类
											</td>
											<td bgcolor="#EFF8E0" height="25" class=text width="150">
												内容/简介
											</td>	
																					
											<%if(request.getAttribute("typeId").equals("9")){ %>
												<td bgcolor="#EFF8E0" height="25" class=text width="200">
													链接地址
												</td>																							
											<%}else{%>
												<td bgcolor="#EFF8E0" height="25" class=text width="200">
													所属地区
												</td>
											<%} %>
																																		
											<td bgcolor="#EFF8E0" height="25" class=text width="150">
												操作
											</td>
										</tr>
										<c:forEach var="lifeInfo" items="<%=allLifeInfo%>">
											<tr align="center">
												<td bgcolor="#FFFFFF" width="50">
													<input type="checkbox" name="lifeInfoIDList" id="lifeInfoIDList"  value="${lifeInfo.id}">
												</td>
												<td bgcolor="#FFFFFF" width="100">
													${lifeInfo.subDate}
												</td>
												<td bgcolor="#FFFFFF" width="100">
													<strong><c:if test="${lifeInfo.typeId == '1' }">
														交友/征婚
													</c:if>
													<c:if test="${lifeInfo.typeId == '2' }">
														招聘/求职
													</c:if>
													<c:if test="${lifeInfo.typeId == '3' }">
														寻人/寻友
													</c:if>
													<c:if test="${lifeInfo.typeId == '4' }">
														租车/拼车
													</c:if>
													<c:if test="${lifeInfo.typeId == '5' }">
														房屋信息
													</c:if>
													<c:if test="${lifeInfo.typeId == '6' }">
														招聘会
													</c:if>
													<c:if test="${lifeInfo.typeId == '7' }">
														生活琐事
													</c:if>
													<c:if test="${lifeInfo.typeId == '8' }">
														同乡会
													</c:if>
													<c:if test="${lifeInfo.typeId == '9' }">
														新闻
													</c:if></strong>
												</td>
												<td bgcolor="#FFFFFF" width="100" align="center">
													<c:if test="${lifeInfo.typeId == '1' }">
														<c:if test="${lifeInfo.kindId == '1' }">
															<font color="green">【&nbsp;交友&nbsp;】</font>
														</c:if>
														<c:if test="${lifeInfo.kindId == '2' }">
															<font color="red">【&nbsp;婚恋&nbsp;】</font>
														</c:if>
													</c:if>
													<c:if test="${lifeInfo.typeId == '2' }">
														<c:if test="${lifeInfo.kindId == '1' }">
															<font color="green">【&nbsp;求职&nbsp;】</font>
														</c:if>
														<c:if test="${lifeInfo.kindId == '2' }">
															<font color="red">【&nbsp;招聘&nbsp;】</font>
														</c:if>
													</c:if>
													<c:if test="${lifeInfo.typeId == '3' }">
														<c:if test="${lifeInfo.kindId == '1' }">
															<font color="green">【&nbsp;寻人&nbsp;】</font>
														</c:if>
														<c:if test="${lifeInfo.kindId == '2' }">
															<font color="red">【&nbsp;寻友&nbsp;】</font>
														</c:if>
													</c:if>
													<c:if test="${lifeInfo.typeId == '4' }">
														<c:if test="${lifeInfo.kindId == '1' }">
															<font color="green">【&nbsp;租车&nbsp;】</font>
														</c:if>
														<c:if test="${lifeInfo.kindId == '2' }">
															<font color="red">【&nbsp;拼车&nbsp;】</font>
														</c:if>
													</c:if>
													<c:if test="${lifeInfo.typeId == '5' }">
														<c:if test="${lifeInfo.kindId == '1' }">
															<font color="green">【&nbsp;中&emsp;介&nbsp;】</font>
														</c:if>
														<c:if test="${lifeInfo.kindId == '2' }">
															<font color="red">【&nbsp;非中介&nbsp;】</font>
														</c:if>
													</c:if>
													<c:if test="${lifeInfo.typeId == '6' }">
														<font color="green">【招聘会】</font>
													</c:if>
													<c:if test="${lifeInfo.typeId == '7' }">
														<font color="green">【 生活琐事】</font>
													</c:if>
													<c:if test="${lifeInfo.typeId == '8' }">
														<font color="green">【同乡会】</font>
													</c:if>
													<c:if test="${lifeInfo.typeId == '9' }">
														<font color="green">【新闻】</font>
													</c:if>
												</td>												
												<td bgcolor="#FFFFFF" width="150" align="left">
													${lifeInfo.content}
													<c:if test="${lifeInfo.typeId == '6' }">
														<br/>
														&emsp;&emsp;<a href="showZhaoPinHuiDetail.jsp?id=${lifeInfo.id}" target="_blank">查看详细</a>
													</c:if>
												</td>
												
												<c:choose>
													<c:when test="${lifeInfo.typeId == '9' }">
														<td bgcolor="#FFFFFF" width="200"  align="center">
															<a href="${lifeInfo.memo}" target="_blank">${lifeInfo.memo}</a>
														</td>
													</c:when>
													<c:otherwise>
														<td bgcolor="#FFFFFF" width="150" align="center">
															${lifeInfo.location}
														</td>
													</c:otherwise>
												</c:choose>
												<td bgcolor="#FFFFFF" align="center" width="150">
													<a href="doLifeInfo.do?opers3=zhiDingLifeInfo&id=${lifeInfo.id}">置顶</a> 
												</td>
											</tr>
										</c:forEach>
									</table>
								</td>
							</tr>
							<tr>
								<td>
									<table width="100%" border="1" cellspacing="1" cellpadding="0"
										bgcolor="737373" bordercolor="#FFFFFF">
										<tr>
											<td>
												<table width="100%" border="0" cellspacing="0"
													cellpadding="0">
													<tr>
														<td bgcolor="B4B4B4" height="20" align="center">
															<%=pageStr%>
														</td>
														<td bgcolor="B4B4B4" height="20" align="right">
															[总记录数：<%=allCounts%>]
														</td>
													</tr>
												</table>
											</td>
										</tr>
									</table>
								</td>
							</tr>
							<tr>
								<td>
									<table width="100%" border="0" cellpadding="0" cellspacing="0">
										<tr>
											<td>
												<input type="checkbox" name="allOper"
													onClick="SetAllCheck(this.form, 'lifeInfoIDList')">
												<font color="#FF0000">全部选中</font>
											</td>
											<td align="right">
												<input type="button" name="operFlag1" value="批量删除 "
													onClick="DoOperateDelete()">&emsp;
												<input type="button" name="operFlag2" value="批量审核 "
													onClick="DoOperateShenHe()">
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</form>
					<br>
				</td>
			</tr>
		</table>
		<table width="1000" border="0" cellspacing="0" cellpadding="5"
			align="center">
			<tr>
				<td bgcolor="B4B4B4" height="10"></td>
			</tr>
			<tr>
				<td align="center">
					版权所有&reg; 邯郸001. 保留所有权利. 黔ICP备12001966号.
				</td>
			</tr>
		</table>
	</body>
</html>